{% extends "squad/user_settings/base.jinja2" %}

{% block page_title %}{{ _('User tokens') }}{% endblock %}

{% block settings %}
<h1>{{ _('API token') }}</h1>

{% if token %}
    <p>{{ _('Your API token:') }}</p>
    <pre>{{token.key}}</pre>
{% else %}
    <div class='alert alert-warning'>
    <p>
    {{ _('You do not have an API token yet.') }}
    </p>
    </div>
{% endif %}

<form method="POST">
    {{ csrf_input }}
    {% if token %}
    <div class='panel panel-danger'>
        <div class='panel-heading'>
            {{ _('Reset API token') }}
        </div>
        <div class='panel-body'>
        <p>
        <strong>{{ _('Attention:') }}</strong>
        {{ _('Resetting your API token will make the old token invalid, and it will no longer be accepted to authenticate API requests. Only the new token will be accepted.') }}
        </p>
        <p>
        <input type="submit" class='btn btn-danger' value="{{ _('Yes, reset my API token') }}"/>
        </p>
        </div>
    </div>
    {% else %}
    <input type="submit" class='btn btn-primary' value="{{ _('Create API token') }}"/>
    {% endif %}
</form>

{% endblock %}

